<?php

/**
 * Empresa form.
 *
 * @package    Sanitas
 * @subpackage form
 * @author     Jose Antonio Sánchez Bedoya
 * @version    SVN: $Id: sfDoctrineFormTemplate.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class EmpresaForm extends BaseEmpresaForm
{
  public function configure()
  {
     //Following code will remove Required validators from these fields.
     unset($this->validatorSchema['created_at']);
     unset($this->validatorSchema['updated_at']);
     unset($this->validatorSchema['validated_at']);
     unset($this->validatorSchema['is_validated']);
     unset($this->validatorSchema['removed_at']);
     unset($this->validatorSchema['remove_it']);
 

     //following code will remove fields from form
     unset($this->widgetSchema['created_at']);
     unset($this->widgetSchema['updated_at']);     
     unset($this->widgetSchema['validated_at']);
     unset($this->widgetSchema['is_validated']);
     unset($this->widgetSchema['removed_at']);
     unset($this->widgetSchema['remove_it']);
     
     //change the widgets we want to make an uploadable file
     $this->setWidget('logo', new sfWidgetFormInputFileEditable( array('edit_mode'=> true,
                                                                       'with_delete' => false,
                                                                       'file_src' => 'http://'.$_SERVER['HTTP_HOST'].'/images/pdfs/'.$this->getObject()->getLogo(),
                                                                       'is_image' => true,)));
	 
     $this->validatorSchema['logo'] = new sfValidatorFile(array(
	                'required'      => false,
	                'mime_types'    => array('image/jpeg', 'image/png', 'image/gif', 'image/pjpeg'),
	                'max_size'      => '1048576',
	                'path'          => sfConfig::get('pdf_empresa_rutaimagenes'),
	            ));
      
    // Relaciono con Configuracion (rel. 1 a muchos), el nombre de la relación lo miro en el schema.yml
    // Lo hago en el action puesto que se puede llamar desde Empresa o desde Configuración y depende desde donde
    // se haga crearé la relación o no.
	//$this->embedRelation('CrmConfiguracion');
  }
  
  
}
